package com.xgg.taiwuinfo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import android.widget.Toast;

import com.xgg.taiwuinfo.gongfa.base.Gongfa;
import com.xgg.taiwuinfo.gongfa.base.GongfaList;
import com.xgg.taiwuinfo.gongfa.base.Gongfa_Jueji_Huti;


public class HutiDetailActivity extends AppCompatActivity {

    int mId;
    Gongfa_Jueji_Huti mGongfa;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hutidetail);

        Intent intent = getIntent();
        try
        {
            mId = intent.getExtras().getInt("id");
            mGongfa = (Gongfa_Jueji_Huti) GongfaList.getList().get(mId);
        }
        catch (Exception e)
        {
            Toast.makeText(this, "获取功法失败", Toast.LENGTH_LONG).show();
            finish();
        }

        TextView txt_name = findViewById(R.id.txt_name);
        txt_name.setTextColor(mGongfa.getLevelColor());
        txt_name.setText(mGongfa.mName);
        TextView txt_element = findViewById(R.id.txt_element);
        txt_element.setTextColor(mGongfa.getElementColor());
        txt_element.setText(mGongfa.getElementString(this));
        TextView txt_inherit = findViewById(R.id.txt_inherit);
        txt_inherit.setText(mGongfa.getInheritString());
        TextView txt_type = findViewById(R.id.txt_type);
        txt_type.setText(mGongfa.getTypeString(this));
        TextView txt_gridoccupy = findViewById(R.id.txt_gridoccupy);
        txt_gridoccupy.setText(mGongfa.getGridOccupy() + "");
        TextView txt_equipeffect = findViewById(R.id.txt_equipeffect);
        txt_equipeffect.setText(mGongfa.getYunGongString(this));
        TextView txt_require = findViewById(R.id.txt_require);
        txt_require.setText(mGongfa.getRequireStr());
        TextView txt_poseff = findViewById(R.id.txt_poseff);
        txt_poseff.setText(mGongfa.getPosReadingString(this));
        TextView txt_negeff = findViewById(R.id.txt_negeff);
        txt_negeff.setText(mGongfa.getNegReadingString(this));
        TextView txt_def = findViewById(R.id.txt_def);
        txt_def.setText(mGongfa.getCastString(this));
        TextView txt_cost = findViewById(R.id.txt_cost);
        txt_cost.setText(mGongfa.getCostString(this));
    }

}
